<!DOCTYPE html>
<html lang='en'>
<head>
  <meta charset='UTF-8'>
  <meta name='viewport' content='width=device-width, initial-scale=1.0'>
  <title></title>
  <script type='text/javascript' src='js/vue.js'></script>
  <script src='js/vue-router_3.0.2.js'></script>
</head>
<body>
  <div id='app'>
      <p>点击跳转即可，默认显示user页面</p>
      <hr>
      <router-link to="/user">user</router-link>
      <router-link to="/register">register</router-link>

      <router-view></router-view>
  </div>
  <script type='text/javascript'>
    var user = {
      template: `<h1>这是user页面</h1>`
    }
    var register = {
      template: `<h1>这是register页面</h1>`
    }
    const router = new VueRouter({
      routes: [
        {path: '/', redirect: '/user'},
        {path: '/user', component: user},
        {path: '/register', component: register}
      ]
    })
    var vm = new Vue({
      el: '#app',
      data: {
        
      },
      methods: {
        
      },
      router
    });
  </script>
</body>
</html>